package com.meituan.catering.management.order.dao.mapper;

import com.meituan.catering.management.order.dao.model.CateringOrderDO;
import com.meituan.catering.management.order.dao.model.request.SearchCateringOrderDataRequest;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 订单对应的MyBatis Mapper
 */
@Mapper
public interface CateringOrderMapper {

    /**
     * 为分页查询计算符合查询条件的总条目数
     *
     * @param searchCateringOrderDataRequest
     * @return
     */
    int countAll(SearchCateringOrderDataRequest searchCateringOrderDataRequest);

    /**
     * 为分页查询符合当前分页码的商品列表
     *
     * @param searchCateringOrderDataRequest
     * @return
     */
    List<CateringOrderDO> searchForPage(SearchCateringOrderDataRequest searchCateringOrderDataRequest);

    /**
     * 根据订单id查询订单详情
     *
     * @param tenantId
     * @param userId
     * @param orderId
     * @return
     */
    CateringOrderDO findById(Long tenantId, Long userId, Long orderId);

    /**
     * 新增订单
     *
     * @param cateringOrderDO
     * @return
     */
    int insert(CateringOrderDO cateringOrderDO);

    /**
     * 针对一个订单制作
     *
     * @param cateringOrderDO
     * @return
     */
    int update(CateringOrderDO cateringOrderDO, Long orderId);

    List<CateringOrderDO> selectAll(Long tenantId, Long userId);
}
